Ext.define('AM.view.baseData.Export', {
    extend: 'AM.default.DefaultWindowForm',
    
    width: 400,
    autoHeight: true,
    
    initComponent: function(){
    	var me = this;
        this.items = [{
        	xtype: "container",
        	layout: "column",
        	items:[{
        		xtype: 'numberfield',
    			fieldLabel: '天数',
    			name: 'daysBefore',
    			id: 'daysBefore',
    	        queryMode: 'local',
    			allowBlank: true,
    			readOnly:false,
				hideTrigger: true,
				vtype: 'blankTrim',
				minValue:0,
				maxValue: 9999,
				value:1,
                columnWidth: .98,
                labelWidth: '40px',
            	margin: '10 0 0 5'
            }, {
                xtype: 'label',
                html: '默认导出一天内有变更的数据，需更早的数据请修改天数',
                style: 'color:red;',
                margin: '10 0 0 2',
                columnWidth: 1
            }]
        }];
        this.buttons = [{
        	text: '确定',
        	scope: this,
        	handler: function(button,event){
        		var win = button.up("window");
        		win.sub();
        	}
        },{
            text: '关闭',
            scope: this,
            handler: function(button, event){
				button.up('window').close();
            }
        }];
        this.callParent(arguments);
    },
    sub: function(){
    	var win = this;
    	var form = win.down('form');
    	var baseForm = form.getForm();
    	if (!baseForm.isValid()) {
    		return;
    	}
    	var href=exportUserHourZipUrl;
    	var daysBefore = baseForm.findField("daysBefore").value;
    	href+=daysBefore?"?daysBefore="+daysBefore:"";
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
		/*win.submit({
			url: exportUserHourZipUrl,
			params: {
				daysBefore: win.daysBefore
			},
    		success: function(f, action){
				Ext.Msg.alert('提示', '操作成功！', function(){
    				win.close();
				});
    		},
    		failure: function(f, action){
    			Ext.Msg.alert('提示', action.result.msg, function(){
					win.close();
				});
    		}
    	});*/
    }
});
